<?php	
defined('YOCTO_EXE') or die(_("Sorry, access Denied."));

/**
 * app/config/setup_check.php
 *
 * @author 		Kris Rybak <kris.rybak@krisrybak.com>	
 * @copyright 	2012 Kris Rybak
 * @since 		File available since Release 1.0.0
 * @version 	1.0.0
*/
	// Add Event  to log
	$app['log'][] = array('time' => microtime(true), 'event' => 'setup_check');

	// This constant defines setup file
	if (!defined("FILE_SETUP_CONFIG")) {
		define('FILE_SETUP_CONFIG', ROOT . DS . DIR_APP . DS .DIR_CONFIG. DS . 'setup.ini');
	}

	// Let's check if the application have been installed
	if (file_exists(FILE_SETUP_CONFIG)) {
		$app['installation'] = true;
		//Parse configuration file
		$ini_array = parse_ini_file(FILE_SETUP_CONFIG, true);
		foreach ($ini_array as $node) {
			foreach ($node as $constant => $value) {
				if(!defined($constant)) {
					define($constant,$value);
				}
			}
		}
		unset($ini_array);
	} else {
		// nothing is installed, we are runnig the application for the first time
		$app['installation'] = false;
	}
	